#ifndef BACKUPPAGE_H
#define BACKUPPAGE_H

#include <QWidget>
#include <QVector>
#include "sql/sqlite/historydao.h"
#include "search/searchengine.h"
#include <QFutureWatcher>
#include "main_window.h"

namespace Ui {
class BackupPage;
}

class BackupPage : public QWidget
{
    Q_OBJECT

public:
    explicit BackupPage(QWidget *parent = nullptr);
    ~BackupPage();
    void setSeacher(SearchEngine<Page::PAGE_BACKUP>* searcher);
    void scrollToItem(qint64 fileId);
    void setMainWindow(MainWindow* mainwindow);

public slots:
    void pullData();

    void handlePullDataResponse(const QByteArray &response);
protected:
    void paintEvent(QPaintEvent *event) override;
private slots:
    void on_Selected_DeleteAllSelectedBtn_clicked();

    void on_Selected_DownloadBtn_clicked();

private:
    Ui::BackupPage *ui;
    int m_i = 0;
    SearchEngine<Page::PAGE_BACKUP>* m_searcherPtr = nullptr;
    int m_currentPage = 1;
    static constexpr int m_pageSize = 50;
    MainWindow* m_mainWindow = nullptr;
};

#endif // BACKUPPAGE_H
